package com.example.myapplication.base.activity

import android.view.View
import androidx.databinding.ViewDataBinding
import com.example.myapplication.base.utils.Utils

abstract class BaseDBActivity<DB : ViewDataBinding> : BaseActivity() {


    lateinit var binding: DB

    private var _binding: DB? = null


    override fun onBindContent(): View? {
        _binding = createViewDataBinding()
        _binding?.let {
            it.lifecycleOwner = this
            binding = it
        }
        return _binding?.root
    }

    protected open fun createViewDataBinding(): DB? {
        return Utils.createViewDataBinding(this, layoutInflater)
    }


    override fun onDestroy() {
        super.onDestroy()
        _binding?.unbind()
    }


}